package com.dbkj.common.render;

import com.jfinal.kit.Kv;
import com.jfinal.render.JsonRender;
import com.jfinal.render.Render;
import com.jfinal.render.RenderFactory;

/**
 * @Author: Max
 * @Date: 2019/8/9 12:01
 */

public class MyRenderFactory extends RenderFactory {
    @Override
    public Render getErrorRender(int errorCode){
        if(errorCode == 404){
            return new JsonRender(Kv.by("code",404).set("msg","路径不存在"));
        }
        if(errorCode == 403){
            return new JsonRender(Kv.by("code",403).set("msg","请求拒绝"));
        }
        if(errorCode == 500){
            return new JsonRender(Kv.by("code",500).set("msg","内部程序发生异常"));
        }
        if(errorCode == 405){
            return new JsonRender(Kv.by("code",405).set("msg","Method Not Allowed"));
        }
//        if(errorCode == 422){
//            return new JsonRender(Kv.by("code",422).set("msg","填写的数据有问题,请查看群/组/相关配置的数据"));
//        }
        return super.getErrorRender(errorCode);
    }

}
